package com.nondo.dean.auth.mapper;

import com.nondo.dean.auth.domain.UserDealer;
import com.nondo.dean.auth.domain.UserDealerExample;
import com.nondo.dean.auth.domain.UserDealerKey;
import com.nondo.dean.common.mybatis.Table;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.JdbcType;

@Table("auth_user_dealer")
@Mapper
public interface UserDealerMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table auth_user_dealer
     *
     * @mbg.generated Wed Jun 13 10:57:13 CST 2018
     */
    @SelectProvider(type=UserDealerSqlProvider.class, method="countByExample")
    long countByExample(UserDealerExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table auth_user_dealer
     *
     * @mbg.generated Wed Jun 13 10:57:13 CST 2018
     */
    @DeleteProvider(type=UserDealerSqlProvider.class, method="deleteByExample")
    int deleteByExample(UserDealerExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table auth_user_dealer
     *
     * @mbg.generated Wed Jun 13 10:57:13 CST 2018
     */
    @Delete({
        "delete from auth_user_dealer",
        "where user_id = #{userId,jdbcType=BIGINT}",
          "and dealer_id = #{dealerId,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(UserDealerKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table auth_user_dealer
     *
     * @mbg.generated Wed Jun 13 10:57:13 CST 2018
     */
    @Insert({
        "insert into auth_user_dealer (user_id, dealer_id, ",
        "dealer_name)",
        "values (#{userId,jdbcType=BIGINT}, #{dealerId,jdbcType=BIGINT}, ",
        "#{dealerName,jdbcType=VARCHAR})"
    })
    int insert(UserDealer record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table auth_user_dealer
     *
     * @mbg.generated Wed Jun 13 10:57:13 CST 2018
     */
    @InsertProvider(type=UserDealerSqlProvider.class, method="insertSelective")
    int insertSelective(UserDealer record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table auth_user_dealer
     *
     * @mbg.generated Wed Jun 13 10:57:13 CST 2018
     */
    @SelectProvider(type=UserDealerSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="dealer_id", property="dealerId", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="dealer_name", property="dealerName", jdbcType=JdbcType.VARCHAR)
    })
    List<UserDealer> selectByExampleWithRowbounds(UserDealerExample example, RowBounds rowBounds);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table auth_user_dealer
     *
     * @mbg.generated Wed Jun 13 10:57:13 CST 2018
     */
    @SelectProvider(type=UserDealerSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="dealer_id", property="dealerId", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="dealer_name", property="dealerName", jdbcType=JdbcType.VARCHAR)
    })
    List<UserDealer> selectByExample(UserDealerExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table auth_user_dealer
     *
     * @mbg.generated Wed Jun 13 10:57:13 CST 2018
     */
    @Select({
        "select",
        "user_id, dealer_id, dealer_name",
        "from auth_user_dealer",
        "where user_id = #{userId,jdbcType=BIGINT}",
          "and dealer_id = #{dealerId,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="dealer_id", property="dealerId", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="dealer_name", property="dealerName", jdbcType=JdbcType.VARCHAR)
    })
    UserDealer selectByPrimaryKey(UserDealerKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table auth_user_dealer
     *
     * @mbg.generated Wed Jun 13 10:57:13 CST 2018
     */
    @UpdateProvider(type=UserDealerSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") UserDealer record, @Param("example") UserDealerExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table auth_user_dealer
     *
     * @mbg.generated Wed Jun 13 10:57:13 CST 2018
     */
    @UpdateProvider(type=UserDealerSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") UserDealer record, @Param("example") UserDealerExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table auth_user_dealer
     *
     * @mbg.generated Wed Jun 13 10:57:13 CST 2018
     */
    @UpdateProvider(type=UserDealerSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(UserDealer record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table auth_user_dealer
     *
     * @mbg.generated Wed Jun 13 10:57:13 CST 2018
     */
    @Update({
        "update auth_user_dealer",
        "set dealer_name = #{dealerName,jdbcType=VARCHAR}",
        "where user_id = #{userId,jdbcType=BIGINT}",
          "and dealer_id = #{dealerId,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(UserDealer record);
}